import { HconsultdataApi, getdetaillistApi } from "../../utils/api.js";
export default {
  state() {
    return {
      consultlist: [],
      detaillist: "",
    };
  },
  mutations: {
    // 首页数据请求
    getconsultlist(state, payload) {
      state.consultlist = payload;
    },
    //咨询详情页面数据获取
    getdetaillist(state, payload) {
      state.detaillist = payload;
    },
  },
  actions: {
    // 首页数据请求接口
    async consultdata({ commit }) {
      const res = await HconsultdataApi();
      commit("getconsultlist", res.list[0]);
      // console.log(res.list[0]);
    },

    //咨询详情页面数据获取
    async getdetaillist({ commit }, data) {
      const res = await getdetaillistApi(data);
      commit("getdetaillist", res.list[0]);
      console.log(res.list[0]);
    },
  },
};
